//Global ajax handler
function doAjax(type,url,data,callbackfunction){
$.ajax({
	type:type,
	url:url,
	data:data,
	success:function(xhr,textStatus,error){
		callbackfunction.fire(xhr);
	}
});
}
//Need function that take the canvas and save picture, then update a string to be published as a post_meta_info
//Need a ajax function that submit to php and get back a sequence of thumbnails link and put them in grid

//Need an ajax function that submit to php and get back a string, and use that to find what to display for a post.
//function that runs when resizing windows, keep the div size correct. 

/* drag a picture to div */
function drop(ev){
	if(ev.target.find("img")==NULL){
	ev.preventDefault();
	var imgid=ev.dataTransfer.getData("pic");
	var imgsrc=ev.dataTransfer.getData("src");
	var img=$('<img >');
	img.src=imgsrc;//TODO: ajax call to get the src of the img. using the id
	ev.target.appendChild(img);
	}
}

function dragstart(ev){
	ev.dataTransfer.setData("pic",ev.target.id);
	ev.dataTransfer.setData("src",ev.target.src);
}
function allowDrop(ev){
	
}
